<template>
  <!--  带边框的样式  -->
  <el-form
    ref="form"
    :model="formData"
    :label-width="labelWidth + 'px'"
    size="mini"
  >
    <el-row>
      <el-col
        v-for="(item, index) in detailsList"
        :key="index"
        :span="item.span ? item.span : 24"
      >
        <el-form-item v-if="item.type == 'slot'" :label="item.label">
          <slot :name="item.field" />
        </el-form-item>
        <el-form-item v-else :label="item.label">
          <template #label="scope">
            <el-tooltip v-if="item.label.length > 14" class="item" effect="light" :content="item.label+''" placement="top-end">
              <el-button class="btn-content-label" type="text">{{
                item.label
              }}
              </el-button>
            </el-tooltip>
            <template v-else>
              {{
                item.label
              }}
            </template>
          </template>
          <el-tooltip v-if="formData[item.field]!=null && formData[item.field]!='' && formData[item.field].length > 30" class="item" effect="dark" placement="top-start">
            <template slot="content">
              <!--              :content="formData[item.field]!=null?formData[item.field]+'':''"-->
              <span>{{ formData[item.field]+'' }}</span>
            </template>
            <span class="btn-content" type="text">{{
              formData[item.field]
            }}
            </span>
          </el-tooltip>
          <span v-else>
            <template slot="content">
              <!--              :content="formData[item.field]!=null?formData[item.field]+'':''"-->
              <span>{{ formData[item.field]+'' }}</span>
            </template>
            <span class="btn-content" type="text">{{
              formData[item.field]
            }}
            </span>
          </span>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
export default {
  name: 'HkDetails',
  props: {
    labelWidth: {
      type: String,
      default() {
        return '100'
      }
    },
    detailsList: {
      type: Array,
      default() {
        return []
      }
    },
    formData: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {}
  },
  watch: {
    formData: {
      handler(newVal) {

      }
    }
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
#app.dark-theme  {
  .el-form-item{
  border-top:1px solid rgba(59, 139, 255, 0.4) !important;
  border-bottom:1px solid rgba(59, 139, 255, 0.4) !important;
}
.btn-content,.btn-content-label{
  color: #fff !important;
}
}
.flex-row{
  display: flex;
  flex-wrap: wrap;
}
::v-deep .el-form-item {

  margin-bottom: 0 !important;
  border-top: 1px solid #E5E5E5;
  border-bottom: 1px solid #E5E5E5;
  margin-top: -1px;
}

::v-deep .el-form-item__label {
  background: #f9fafd !important;
  font-weight: 100;
  line-height:38px;
  padding:0 0 0 10px;
  font-weight: 600;
}

::v-deep .el-form-item__content {
  height:36px;
  line-height:36px;
  overflow: hidden; //溢出隐藏
  white-space: nowrap; //禁止换行
  text-overflow: ellipsis; //...
}

::v-deep .btn-content {
color:#606266 !important;padding:0 7px !important;
  width: 100%;
  span {
    width: 100%;
    text-align:left;
    font-size: 14px !important;
    display: block !important;
    overflow: hidden !important; //溢出隐藏
    white-space: nowrap !important; //禁止换行
    text-overflow: ellipsis !important; //...
  }
}
::v-deep .btn-content-label{
  color: #606266 !important;padding:0 10px;padding:0 10px;
  font-weight: 600;

  width:100%;
  span{
    width:100%;
    font-size: 14px;
    display: inline-block !important;
    overflow: hidden !important; //溢出隐藏
    white-space: nowrap !important; //禁止换行
    text-overflow: ellipsis !important; //...
  }
}

</style>
